package com.ewili.x.special.service.data.impl;

import com.ewili.x.special.dao.inter.FailUrlDao;
import com.ewili.x.special.entity.FailUrl;
import com.ewili.x.special.service.data.inter.ExceptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ExceptionServiceImpl implements ExceptionService {

    @Autowired
    private FailUrlDao failUrlDao;

    @Transactional
    @Override
    public void failUrl(String url, String type) {
        FailUrl failUrl = failUrlDao.findOneByFailUrlAndType(url, type);
        if (failUrl == null) {
            failUrl = new FailUrl();
            failUrl.setFailUrl(url);
            failUrl.setType(type);
            failUrlDao.save(failUrl);
        }
    }
}
